#include "shellsort.h"
#include "util.h"



void shellSort(int array[],int length){
    int h = 1;
    while (h < length / 3){
        h = 3 * h + 1;
    }
    while (h >= 1){
        int i ,j;
        for (i = h; i < length; i++){
            for (j = i; j >= h && (array[j] < array[j-h]); j -= h){
                swap(&array[j],&array[j-h]);
            }
        }
        h = h / 3;
    }
}
